import requests
import execjs

cookies = {
    'Hm_lvt_6088e7f72f5a363447d4bafe03026db8': '1698996436',
    'Hm_lpvt_6088e7f72f5a363447d4bafe03026db8': '1698996656',
}

headers = {
    'Accept': '*/*',
    'Accept-Language': 'zh-CN,zh;q=0.9',
    'Connection': 'keep-alive',
    'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
    # 'Cookie': 'Hm_lvt_6088e7f72f5a363447d4bafe03026db8=1698996436; Hm_lpvt_6088e7f72f5a363447d4bafe03026db8=1698996656',
    'Origin': 'https://www.aqistudy.cn',
    'Referer': 'https://www.aqistudy.cn/historydata/daydata.php?city=%E4%B8%8A%E6%B5%B7&month=201312',
    'Sec-Fetch-Dest': 'empty',
    'Sec-Fetch-Mode': 'cors',
    'Sec-Fetch-Site': 'same-origin',
    'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.0.0 Safari/537.36',
    'X-Requested-With': 'XMLHttpRequest',
    'sec-ch-ua': '"Chromium";v="118", "Google Chrome";v="118", "Not=A?Brand";v="99"',
    'sec-ch-ua-mobile': '?0',
    'sec-ch-ua-platform': '"Windows"',
}

js_file = open('逆向JS.js','r',encoding='utf-8').read()

js_data = execjs.compile(js_file).call("param")
data = {
    'hA4Nse2cT': js_data,
}

response = requests.post('https://www.aqistudy.cn/historydata/api/historyapi.php', cookies=cookies, headers=headers, data=data)

js_data = execjs.compile(js_file).call("dxvERkeEvHbS",response.text)

print(js_data)